<?php
if (!isset($_SESSION)) {
  session_start();
}

$captcha = imagecreatefrompng('sebg.png');

//set some variables
$red = imagecolorallocate($captcha, 0, 255, 0);

$font = 'monofont.ttf';
//random stuff
$string = md5(microtime());

$text = substr($string, 0, 6);

//Create some stuff

imagestring($captcha, 15, 15, 5, $text, $red);

header('Content-type: image/jpeg');
imagejpeg($captcha);
//Clean up
imagedestroy($captcha);
$_SESSION['security_code'] = $text;
?>